<%@page import="backpage.view.ResItem"%>
<%@page import="backpage.view.PageDivision"%>
<%@page import="com.model.User"%>
<%@page import="javassist.bytecode.stackmap.BasicBlock.Catch"%>
<%@page import="javax.xml.ws.RespectBinding"%>
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/backPage/";
	User user = (User) session.getAttribute("userInfo");
	if (user == null || !user.getState().equals("teacher"))
		response.sendRedirect("login.jsp");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="Teacher's entry for Software Engineering Course" />
		<s:head theme="xhtml" />
		<sx:head parseContent="true" />


		<title>Teacher's entry for Software Engineering Course</title>
		<link rel="stylesheet" type="text/css" href="css/backpage.css" />
		<script type="text/javascript" src="js/default.js"></script>
		<script type="text/javascript">
			function checkdate(){  		
				var start= document.getElementById("start").value;
				var end= document.getElementById("end").value;
				var content= document.getElementById("content").value;
				
				//start=start.replace(/(^\s*)|(\s*$)/g, "");
				//end=end.replace(/(^\s*)|(\s*$)/g, "");
				content=content.replace(/(^\s*)|(\s*$)/g, "");
				var starts = eval("("+start+")");
				alert(start);
				if(starts==null || end==null || content==null) {
					alert("日期不能为空！"); 
					start.focus();
					return false;
				}
				if(start >= end){
					alert("结束日期应该晚于开始日期！");   
					end.focus();
					return false;			
				}
				return true;
			}
		</script>
	</head>

	<body>

		<div id="Header">

			<div id="Logon">
				<div id="Logon">
					<form>
						<table>
							<tr>
								<td>
									欢迎您
									<s:property value="#session.userInfo.getName()" />
								</td>
								<td class="seperator"></td>
								<td>
									<a href="../backlogin!logout.action">退出</a>
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
			
			<div id = "Logo">
				<img src="<%=basePath%>img/logo.png" alt="南开大学" />
			</div>
		
			<div id="Navigation">
				<table>
					<tr>
						<td id="nav_doc">
							<a href="?resType=doc" style="font-family: '微软雅黑';">教学课件</a>
						</td>
						<td id="nav_video">
							<a href="?resType=video" style="font-family: '微软雅黑';">教学视频</a>
						</td>
						<td id="nav_software">
							<a href="?resType=software" style="font-family: '微软雅黑';">教学软件</a>
						</td>
						<td id="nav_reference">
							<a href="?resType=reference" style="font-family: '微软雅黑';">参考资料</a>
						</td>
						<td id="nav_notice">
							<a href="../notices!showNotices.action" style="font-family: '微软雅黑';">课程通知</a>
						</td>
						<td id="nav_exam">
							<a href="jsp/addexam.jsp" style="font-family: '微软雅黑';">题目管理</a>
						</td>
					</tr>
				</table>
			</div>
		</div>

		<div id="MainContent">

			<div id="TopLine"></div>

			<table border="0">
				<tr>

					<td valign="top" class="content_left">
						<div id="Menu">
							<div id="MenuTop"></div>
							<div id="MenuMid">

								<div id="MenuUnit" class="search">
								  <ul>
									<li>
										检索字段
										<input id="keyWord" name="keyWord" type="text" />
									</li>
									<li>
										字段类型
										<select id="wordType" name="wordType" disabled="disabled">
											<option value="all">
												所有
											</option>
										</select>
									</li>
									<li>
										检索范围
										<select id="searchScope" name="searchScope" disabled="disabled">
											<option value="<%=request.getParameter("resType")%>">
												当前选项卡
											</option>
										</select>
									</li>
									<li class="center">
										<input type="button" value="检索" disabled="disabled" />
									</li>
								  </ul>
								</div>

								<div id="MenuUnit" class="catalogue">
									<ul><li>
										<a href="">默认归档</a>
									</li></ul>
								</div>
							</div>
							<div id="MenuBottom"></div>
						</div>
					</td>

					<td valign="top" class="content_right">
						<div id="MainContent" style="background-color: #ffffff;">
							<table border="0">
								
								<tr bgcolor="#deb6ff">
									<th>
										内容
									</th>
									<th width="20%">
										发布时间
									</th>
									<th width="20%">
										截止时间
									</th>
									<th width="10%">
										操作
									</th>
								</tr>
								<tr>
									<td colspan="4"><hr style="dotted"></td>
								</tr>
								<s:iterator var="notices" value="#notices">
									<tr align="center">
										<s:hidden name="id" value="id" />
										<td align="left">
											<li style="list-style:inside square;"><s:property value="content" /></li>
										</td>
										<td>
											<s:property value="start" />
										</td>
										<td>
											<s:property value="end" />
										</td>
										<td>
											<s:a action="notices" method="deleteNotices" namespace="/">
   												<s:param name="id"  value="#notices.id"  />
   												删除
   											</s:a>
										</td>
									</tr>
								</s:iterator>
								<tr>
									<td colspan="4">
										<s:form method="post" action="notices" namespace="/" onsubmit="checkdate()">		
											<table border="0" align="center">
												<tr>
													<td>
														起始日期：
													</td>
													<td>
														<sx:datetimepicker name="start" id="start" displayFormat="yy-MM-dd" />
													</td>
													<td>
														结束日期：
													</td>
													<td>
														<sx:datetimepicker name="end" id="end" displayFormat="yy-MM-dd" />
													</td>
												</tr>
												<tr>
													<td>
														内容：
														</td>
														<td colspan="3">
														<textarea name="content" id="content" cols="50" rows="4" ></textarea>
													</td>
												</tr>
												<tr>
													<td colspan="4" align="right">
														<s:submit value="确认" method="addNotices" />
													</td>
												</tr>
											</table>
										</s:form>

									</td>
								</tr>
							</table>
						</div>


					</td>
				</tr>
			</table>

			<div id="BottomLine"></div>
			<script type="text/javascript">
				navClicked("notice");
			</script>
		</div>

		<div id="Footer">
			<table width="100%">
				<tr>
					<td>
						<a href="../index.jsp">返回前台</a>
						<s:a action="init.action" namespace="/">论坛学习</s:a>
						<a href="http://www.nankai.edu.cn" target="view_window">南开大学</a>
						<a href="http://cs.nankai.edu.cn" target="view_window">软件学院</a>
						<a href="http://soft.nankai.edu.cn" target="view_window">软件之家</a>
						<a href="http://music.nankai.edu.cn" target="view_window">世外桃源</a>
						<a href="http://movie.nankai.edu.cn" target="view_window">光影传奇</a>
						<a href="http://music.nankai.edu.cn" target="view_window" style="border-right: none;">联系我们</a>
					</td>
				</tr>
				<tr>
					<td>
						<p style="float:left; margin-top: 5px; margin-left: 300px; color: #3a91b8;">版权所有@南开大学软件学院</p>
						<p style="margin-top: 5px; margin-right: 200px; color: #3a91b8;">联系地址：天津市南开区卫津路94号南开大学13宿</p>	
					</td>
				</tr>
		</table>
		</div>

	</body>
</html>